import {
	Base64
} from '../js_sdk/js-base64/base64.js';

function getToken() {
	const token = uni.getStorageSync('token') || '';
	const base64_token = Base64.encode(token + ':');
	return 'Basic ' + base64_token
}
export function https(params) {
	wx.showLoading({
		title: '加载中···',
	})
	let basUrl = 'https://meituan.thexxdd.cn/api'
	let token = wx.getStorageSync('token')
	return new Promise((resovle, reject) => {
		wx.request({
			...params,
			url: basUrl + params.url,
			header: {
				Authorization: getToken()
			},
			success: (res) => {
				resovle(res)
			},
			fail: (res) => {
				reject(res)
			}
		})
		wx.hideLoading({
			success: (res) => {},
		})
	})
}